import request from '@/utils/request'

// 查询高级查询sql列表
export function listSearchSqlBase(query) {
  return request({
    url: '/base/searchSqlBase/list',
    method: 'get',
    params: query
  })
}

// 查询所有高级查询的id和名称
export function allListSearchSqlBase() {
  return request({
    url: '/base/searchSqlBase/allList',
    method: 'get'
  })
}

// 查询高级查询sql详细
export function getSearchSqlBase(id) {
  return request({
    url: '/base/searchSqlBase/' + id,
    method: 'get'
  })
}

// 保存高级查询sql
export function saveSearchSqlBase(data) {
  return request({
    url: '/base/searchSqlBase/save',
    method: 'post',
    data: data
  })
}

// 根据sql脚本查询字段
export function getColumnBySql(data) {
  return request({
    url: '/base/searchSqlBase/getColumnBySql',
    method: 'post',
    data: data
  })
}

// 预览结果
export function previewSqlResult(data) {
  return request({
    url: '/base/searchSqlBase/previewSqlResult',
    method: 'post',
    data: data
  })
}

// 删除高级查询sql
export function delSearchSqlBase(id) {
  return request({
    url: '/base/searchSqlBase/' + id,
    method: 'delete'
  })
}

// 导出高级查询sql
export function exportSearchSqlBase(query) {
  return request({
    url: '/base/searchSqlBase/export',
    method: 'get',
    params: query
  })
}

export function submitDeployment(data) {
  return request({
    url: '/base/searchSqlBase/deployment',
    method: 'post',
    data: data
  })
}
